﻿namespace ctolua.Models
{
    /// <summary>
    /// 魔法效果
    /// </summary>
    public class MModifier
    {
        /// <summary>
        /// 魔法效果
        /// </summary>
        public ModifierEntity modifier { get; set; }
        /// <summary>
        /// 获取buff的唯一id
        /// </summary>
        /// <returns>魔法效果唯一ID</returns>
        public int? id => modifier.api_get_modifier_unique_id();
        /// <summary>
        /// 获取buff的类型key
        /// </summary>
        /// <returns>魔法效果key</returns>
        public int? key => modifier.api_get_modifier_key();
        /// <summary>
        /// 关联技能
        /// </summary>
        /// <returns>技能</returns>
        public Ability get_ability => global_api.get_related_ability(this.modifier);
        /// <summary>
        /// 返回指定魔法效果类型的描述
        /// </summary>
        /// <param name="modifier_key ">  魔法效果ID   </param>
        /// <returns>描述</returns>
        public string desc => game_api.get_modifier_desc_by_type(this.key);
        /// <summary>
        /// 返回指定魔法效果类型的名称
        /// </summary>
        /// <param name="modifier_key ">  魔法效果ID   </param>
        /// <returns>描述</returns>
        public string name => game_api.get_modifier_name_by_type(this.key);
        /// <summary>
        /// 获取魔法效果icon图标的图片id
        /// </summary>
        /// <param name="key ">  魔法效果编号   </param>
        /// <returns>图片id</returns>
        public int? icon => game_api.get_icon_id_by_buff_type(key);
        /// <summary>
        /// 效果实体是否存在
        /// </summary>
        /// <param name="modifier ">  效果实体   None</param>
        /// <returns>布尔值</returns>
        public bool? is_null() => game_api.modifier_is_exist(this.modifier);

        public MModifier(ModifierEntity modifier)
        {
            this.modifier = modifier;
        }
        public static MModifier obj(ModifierEntity modifier)
        {
            return new MModifier(modifier);
        }

    }
}
